﻿using FoodModel;
using J.FoodRepository.InterFace;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace J.FoodRepository.Impl
{
    public class TasteRepository : BackRepository<TasteModel>, ITasteRepository
    {
        public TasteRepository(ISqlSugarClient db) : base(db)
        {
        }
        /// <summary>
        /// 口味添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task<int> TasteAdd(TasteModel model)
        {
            return await base.AddAsync(model);
        }
        /// <summary>
        /// 口味反填
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<List<TasteModel>> TasteBack(string id)
        {
            var idList = id.Split(",").Select(int.Parse);
            var list = await base.GetAsync(propa => idList.Contains(propa.TasteId));
            return list;
        }
    }
}
